//获取应用实例
const app = getApp();

Page({
  data: {
    queslist: [{}]
  },
  onLoad: function() {
    this.questions();
  },



  //获取文章列表
  questions() {
    var that = this;
    wx.request({
      url: app.globalData.api + '/app.php?c=Article&a=getArticleList',
      data: {
        token: app.globalData.token,
        cat_id:3
      },
      headers: {
        'platform': '' + app.globalData.platform,
        'version': '' + app.globalData.version,
      },
      method: 'POST',
      dataType: 'json',
      success: function(res) {
        console.log(res);

        if (res.data.code == 0) {
          for (var i = 0; i < res.data.data.list.length; i++) {
            res.data.data.list[i].img = app.globalData.imgUrl + "" + res.data.data.list[i].img;
          }
          that.setData({
            queslist: res.data.data.list
          })
        }
      },
      fail: function() {

      }
    });
  },
  todetail: function(e) {
    wx.navigateTo({
      url: '/pages/mine/question-detail',
    })
  }
});